home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Networking / OTSimpleDownloadHTTP1.0d3 / OTSimpleDownloadHTTP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-09  |  1.8 KB  |  51 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        OTSimpleDownloadHTTP.h
  3.  
  4.     Contains:    Interface to the simple HTTP download sample.
  5.  
  6.     Written by:    Quinn "The Eskimo!"
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.     You may incorporate this sample code into your applications without
  13.     restriction, though the sample code has been provided "AS IS" and the
  14.     responsibility for its operation is 100% yours.  However, what you are
  15.     not permitted to do is to redistribute the source as "DSC Sample Code"
  16.     after having made changes. If you're going to re-distribute the source,
  17.     we require that you make it clear in the source that the code was
  18.     descended from Apple Sample Code, but that you've made changes.
  19. */
  20.  
  21. #include <Types.h>
  22.  
  23. OSStatus DownloadHTTPSimple(const char *hostName,
  24.                             const char *httpCommand,
  25.                             const short destFileRefNum);
  26.  
  27. // Download a URL from the a web server.  hostName is a pointer
  28. // to a string that contains the DNS address of the web server.
  29. // The DNS address must be suffixed by ":<port>", where <port>
  30. // is the port number the web server is operating on.
  31. // httpCommand contains the HTTP command to send.  Typically this
  32. // is of the form:
  33. //
  34. //        GET <x> HTTP/1.0\0x13\0x10\0x13\0x10
  35. //
  36. // where <x> is the URL path.  destFileRefNum is the file
  37. // reference number to which the results of the HTTP command
  38. // are written.  This routine does not parse the returned HTTP
  39. // header in any way.  The entire incoming stream goes into
  40. // the file verbatim.
  41. //
  42. // For example, if you were asked to download a URL like:
  43. //
  44. //        http://devworld.apple.com/dev/technotes.shtml
  45. //
  46. // you would set:
  47. //
  48. //         o hostName to "devworld.apple.com:80" (80 is the
  49. //          default port for HTTP.
  50. //        o httpCommand to "GET /dev/technotes.shtml HTTP/1.0\0x13\0x10\0x13\0x10"
  51.